perm filename EXAMP.PUB[2,TES] blob sn#009881 filedate 1972-06-02 generic text, type T, neo UTF8
COMMENT ⊗   VALID 00050 PAGES 
RECORD PAGE   DESCRIPTION
 00001 00001
 00006 00002	.COMMAND CHARACTER "$" 
 00012 00003	$PORTION MATERIAL
 00015 00004	$ss OPERATION
 00023 00005	$SS READING THIS MANUAL
 00029 00006	PUB will number your pages 1,#2,#3, etc. unless you declare otherwise.
 00034 00007	$BEGIN SKIP TO COLUMN 1 VERBATIM
 00037 00008	$COMMAND CHARACTER "." 
 00041 00009	$sec TEXT CONVENTIONS
 00045 00010	$SS JUSTIFICATION
 00053 00011	$ss WORD BREAKS
 00056 00012	α-\FILL mode only, and not the first character of a word: a ≤hyphen≥.  This means:
 00061 00013	
 00063 00014	$ss CONTROL CHARACTER ACTIVATION
 00067 00015	$SS COMPUTED TEXT,BLURT:
 00070 00016	$sec MACROS
 00073 00017	$ss TEMPLATES
 00077 00018	$ss OMISSIONS
 00080 00019	$sec EXPRESSIONS
 00081 00020	$ss VARIABLES
 00087 00021	$ss SIMPLE EXPRESSIONS,SIMPEX:
 00090 00022	$ss GENERAL EXPRESSIONS
 00092 00023	$sec STATEMENTS
 00094 00024	$ss COMPOUND STATEMENT or CLUMP
 00097 00025	$SEC DECLARATIONS
 00101 00026	$ss PREFACE DECLARATION
 00106 00027	$Ss MARGIN CONTROL,MARGS:
 00110 00028	$ss PLACE DECLARATION
 00114 00029	$ss COUNTER DECLARATION,COUNTERD:
 00117 00030	$sec IMPERATIVES
 00122 00031	$BEG
 00128 00032	$SS PORTION DEMARCATION,PORTIONS:
 00131 00033	$SS SEND STATEMENT,SENDS:
 00135 00034	$ss RECEIVE STATEMENT
 00140 00035	$ss SKIP STATEMENTS,SKIPS:
 00144 00036	$ss CONTINUE STATEMENT,CONTI:
 00149 00037	$sec COMMENTS
 00151 00038	$sec LABELS AND CROSS-REFERENCES
 00156 00039	$SKIP
 00162 00040	$SEC RESPONSES
 00166 00041	$SS TRANSITION RESPONSES,HEDRESP:
 00171 00042	$SEC FOOTNOTES
 00174 00043	$PORTION APPENDICES
 00176 00044	$APP THOROUGHLY EXPLAINED EXAMPLES
 00179 00045	$SAPP SAMPLE TABLE OF CONTENTS
 00181 00046	$SAPP ONE-LEVEL INDEXES,INDEXIX:
 00187 00047	$SAPP TWO-LEVEL INDEXES
 00192 00048	$SAPP KWIC INDEXES
 00194 00049	$COUNT PAGE PRINTING "I" 
 00195 00050	$COUNT PAGE PRINTING "i"
 00196 ENDMK
⊗;
.COMMAND CHARACTER "$" ;
$TURN ON "{αβ↑↓_[]#\∂←→∞&∪"
$MACRO INS ⊂ONCE NOFILL; PREFACE 0 ; INDENT 0⊃ ;
$MACRO BEG ⊂INS BEGIN SKIP GROUP⊃ ;
$MACRO SYN ⊂ INS
	Syntax:
$INS⊃ ;
$TABS 10,20,30,40,50,60,70
$D ← 25 <<FOR ∂>>
$PORTION TITLEPAGE
$INDENT 0,0,0
$BEGIN
$NOFILL
STANFORD ARTIFICIAL INTELLIGENCE PROJECT→{MONTH} {YEAR}
OPERATING NOTE 70
$END
$SKIP 4
$BEGIN
$CENTER
PUB
$SKIP 1
The Document Compiler
$SKIP 3
by
$SKIP 1
Larry Tesler
$END
$SKIP 2
ABSTRACT:
$BREAK
PUB is an advanced text justifier and page formatter intended
primarily for use by programmers.
It can automatically number pages, sections, figures, footnotes, etc. and can
print their numbers in roman numerals as well as in digit or letter form.
It can generate cross references, tables of contents, and indexes.
Page layout is flexible, and allows multiple column output.  Line formatting
includes tabs, underlining, superscripts, subscripts, centering, and
justification.  Macros programmed in a SAIL-like string-processing language can
generate text to be printed in the document.
The output of the compiler is a file which
can be printed on the terminal, on the line printer, or on microfilm.
$SKIP 3
$ONCE NOFILL
ACKNOWLEDGMENTS:
Les Earnest created the concept of the Document Compiler and specified most of
its capabilities.

Dan Swinehart provided invaluable advice and aid throughout
the development of PUB.

Russ Taylor programmed the FR-80 preprocessor.

This work was supported in part by the Advanced Research Projects Agency of
the Department of Defense under Contract SD 183.
$MACRO SEC(NAME) ⊂ NEXT PAGE NEXT SECTION BEGIN CENTER
$CURRSS ← NULL ; SECNAME ← "PUB" ;
SECTION {!}
$SKIP 1
NAME
$SKIP ; SECNAME ← "NAME" ;
$END SEND CONTENTS ⊂ IF LINES < 10 THEN NEXT PAGE ; SKIP 2 ;
{SECTION!}∂(10)NAME
$SKIP 1
$⊃ SEND INDEX ⊂ }∧NAME%{PAGE!}∨{
$⊃ ⊃ ;
$MACRO SS(NAME,LBL) ⊂ IF LINES<8 THEN NEXT PAGE LBL NEXT SUBSECTION!
$CURRSS ← SUBSECTION! ;
$IF FIRSTSS = NULL THEN FIRSTSS ← CURRSS ELSE LASTSS ← CURRSS ;
$BEGIN NOFILL INDENT 0 SKIP 2

{!} ↓_NAME_↓

$END SEND CONTENTS ⊂
∂(15){SUBSECTION!}∂(25)NAME\∞ ∞.∞ →#{PAGE!}
$⊃ SEND INDEX ⊂ }∧NAME%{PAGE!}∨{
$⊃ ⊃ ;
$COUNT SECTION
$COUNT SUBSECTION IN SECTION PRINTING "!.1"
$FOOTSEP ← "- - - - - - - - - - - - - - - - - - - - - - - - -"
$COUNT APPENDIX ; COUNT SUBAPPENDIX ;
$MACRO YON(LBL) ⊂ "Section " ; SUBSECTION! LBL ⊃
$INDENT 15, 15
$INSERT CONTENTS
$MACRO BEAK ⊂ BEGIN SKIP GROUP PREFACE 0 INDENT 0,15 TABS 12,20 ⊃
$MACRO YAP(LBL) ⊂ "Appendix " ; SUBAPPENDIX! LBL ⊃
$MACRO QUIET ⊂ VERBATIM ⊃
$TITLE AREA FEETING LINE 53
$MACRO PRINSECS ⊂ PLACE FEETING CENTER
$(IF FIRSTSS = NULL THEN CURRSS ELSE IF LASTSS=NULL THEN FIRSTSS ELSE
$FIRSTSS &" - "& LASTSS) ; BREAK ;
$FIRSTSS ← LASTSS ← NULL ⊃
$ODD HEADING (SAILON-70,{SECNAME},Page {PAGE!})
$EVEN HEADING (Page {PAGE!},{SECNAME},SAILON-70)
$AFTER TEXT ⊂PRINSECS⊃
$SECNAME ← FIRSTSS ← LASTSS ← CURRSS ← NULL ;
$AT "≤" PHR "≥" ⊂ }PHR{  SEND INDEX ⊂ }∧PHR%{PAGE!}∨{⊃ ; ⊃ ;
$PORTION MATERIAL
$COUNT PAGE
$SEC INTRODUCTION
$SS PURPOSE
PUB is a compiler which translates a ↓_manuscript_↓ into a ↓_document_↓.

A "≤manuscript≥" is an SOS file containing the text of a publication interspersed
with control characters and commands.  The function of the ↓_compiler_↓ is to arrange
this text on formatted pages under the direction of the control characters and
commands.

Output is written on a ".DOC" file known as the "≤document≥".  TYPE, SPOOL or PRINT it.
Under certain conditions, the document can be edited with TECO (see {YON DEV}), but it
is wiser to make corrections in the manuscript and then rerun the compiler.
$BEG
MANUSCRIPT α→α→α→α→α→α→α→α→ DOCUMENT
###########COMPILER
$END
$ss CAPABILITIES
PUB provides the usual capabilities of a simple text-justifier, including:
$BEG
>Page numbering
>Optional justification to the right margin
>Centering of titles
>Headings and footings
>Control of Spacing and Indentation
>Underlining
$END
In addition, it features advanced documentation capabilities, such as:
$BEG
>Columnar output
>Footnote placement
>Macros
>Index Generation
>Table of contents generation
>Cross-reference to a variable target
>Automatic numbering of equations, tables, notes, etc
>Supersripts and Subscripts
>Microfilm Output
$END
The command language is a dialect of SAIL Algol, providing the user with:
$BEG
>Block structure
>Conditional command execution
>Conditional text inclusion
>Arithmetic and String calculations
>Embedded Source Files
$END
$COUNT PAGE PRINTING "I" ;
$PORTION INDEX
$CURRSS ← NULL ; SECNAME ← "PUB" ;
$BEGIN CENTER
SUBJECT AND COMMAND INDEX
$SKIP 1
(References are to Page numbers)
$END
$SECNAME ← "INDEX" ;
$LETTER ← PHR ← PG ← NEWPHR ← NULL ;
$AT "∧" PHRASE "%" PGNO "∨" ⊂
$NEWPHR ← ↑"PHRASE" ;
$IF LETTER ≠ NEWPHR[1] THEN SKIP 1 ;
$IF NEWPHR ≠ PHR THEN START BREAK }PHRASE  PGNO{ END
$ELSE IF "PGNO" ≠ PG THEN START }, PGNO{ END ;
$PHR ← NEWPHR ; LETTER ← PHR[1] ; PG ← "PGNO" ; ⊃
$BEGIN
$AREA TWOTXT LINES 9 TO 51 IN 2 COLUMNS 3 APART
$PLACE TWOTXT
$FILL CRBREAK NOJUST INDENT 0,3,0 PREFACE 0 RETAIN
$RECEIVE "∧%"
$END
$COUNT PAGE PRINTING "i"
$PORTION CONTENTS
$CURRSS ← NULL ; SECNAME ← "PUB" ;
$BEGIN CENTER
TABLE OF CONTENTS
----- -- --------
$END
$SKIP
$BEGIN NOFILL INDENT 0,0,0
SECTION→PAGE
$END
$SKIP 1
$SECNAME ← "TABLE OF CONTENTS"
$BEGIN FILL CRBREAK NOJUST PREFACE 0
$TABS 36,39,42,45,48,51,54,57,60,63 INDENT 0,35,10
$RECEIVE
$SKIP 2
∂(10)SUBJECT AND COMMAND INDEX\∞ ∞.∞ →###I
$END